package com.example.ddmpay;

import android.os.Bundle;
import android.util.Log;

import androidx.annotation.Nullable;
import androidx.fragment.app.FragmentActivity;

import com.ddm.pay.GPH5PayShareListener;
import com.ddm.pay.GPH5PayShareManager;


public class MainActivity extends FragmentActivity {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        findViewById(R.id.ll_pay_action).setOnClickListener(v -> {
            GPH5PayShareManager.getInstance().payAction(this,
                    "zs29928299",
                    "skuName",
                    "skuCoverImgUrl",
                    "213",
                    "0.05",
                    365,
                    "ZHYTPayProductLevelR5",
                    "1719725403110711298", new GPH5PayShareListener() {
                        @Override
                        public void onPurchaseCompleted(String payOrderMessage) {
                            if (payOrderMessage != null) {
                                Log.d("onPurchaseResult-", payOrderMessage);
                            } else {
                                Log.d("onPurchaseResult-", "onPurchaseCancel");
                            }
                        }

                        @Override
                        public void onPurchaseCancel() {
                            Log.d("onPurchaseResult-", "onPurchaseCancel");

                        }
                    }
            );

        });
    }
}
